<?php
/**
 * Created by PhpStorm.
 * User: zl
 * Date: 2017/6/29
 * Time: 9:26
 */
    require_once ('../Common.php');
    require_once('Standard.php');

    $date = $_REQUEST['date'];
    $city = $_REQUEST['city'];

    $result_array = array();
    if(empty($date) || empty($city)){
        $result_array['state'] = 0;
        $result_array['error'] = 'POST_ERROR';
    }

    $m = date('n', strtotime($date));

    $standard = new Standard();
    $r = $standard->getFeeStandard($city, $m);

    if($r['state'] == 1){
        $result_array['hotel'] = $r['hotel'];
        $result_array['state'] = 1;
    }
    else{
        $result_array['state'] = 0;
        $result_array['error'] = 'DB_ERROR';
    }



    $r = $standard->getOilStandard();
    if($r['state'] == 1){
        $result_array['oil'] = $r['oil'];
        $result_array['state'] = 1;
    }
    else{
        $result_array['state'] = 0;
        $result_array['error'] = 'DB_ERROR';
    }

    $r = $standard->getHotelAndSubsidy();
    if($r['state'] == 1){
        $result_array['food_subsidy'] = $r['food_subsidy'];
        $result_array['state'] = 1;
    }
    else{
        $result_array['state'] = 0;
        $result_array['error'] = 'DB_ERROR';
    }

    echo json_encode($result_array);




?>